package com.shuwen.gcdj.common.enums;

import com.shuwen.gcdj.common.api.IErrorCode;

public enum ErrorCode implements IErrorCode {
    SUCCESS(200L, "操作成功"),
    FAILED(500L, "操作失败"),
    UNAUTHORIZED(401L, "暂未登录或token已经过期"),
    TOKEN_EXPIRED(401L, "暂未登录或token已经过期"),
    FORBIDDEN(404L, "没有相关权限"),
    VALIDATE_FAILED(400L, "参数检验失败"),
    AUTH_TYPE_UNSUPPORTED(406, "仅支持JWT认证"),
    PARAM_LOST(5000L, "参数缺失"),
    PARAM_INVALID(5001L, "参数异常"),
    DATA_NOT_EXIST(5002L, "数据不存在"),
    DATA_HAS_EXIST(5003L, "数据已存在"),
    DATA_DEPTID_EXIST(5004L, "部门id不能为空"),
    TOKEN_CAN_NOT_USE(401L, "TOKEN不可用"),
    USER_NOT_EXIST(5101L, "用户不存在"),
    USER_NOT_ERROR(5101L, "登录名或密码错误"),
    USER_ACCOUNT_PWD_UN_MATCH(5102L, "登录名或密码错误"),
    INVALID_OP(5103L, "非法操作"),
    INVALID_ERROR_DELETE_ADMIN(5103L, "非法操作,不能修改超级管理员"),
    INVALID_OP_OA_HAS_BEEN_FORBIDDEN(5104L, "AD账号已禁用"),
    INVALID_OP_CAN_NOT_SET_OA_FORBIDDEN(5105L, "不可主动将启用状态设置为AD域禁用状态"),
    ONLY_SUPPORT_CUSTOMER_LOGIN(5106L, "仅支持自定义账号登录"),
    OSS_ACCESS_TOKEN_ERROR(5107L, "SSO获取AccessToken错误"),
    OSS_GET_USER_INFO_ERROR(5108L, "SSO获取用户信息错误"),
    TOKEN_LOST_USER_ID(401L, "token解析后缺少用户信息"),
    TOKEN_LOST_RANDOM_CODE(401L, "token验证伪随机码失败"),
    TOKEN_PARSE_ERROR(401L, "token解析失败"),
    USER_LOGIN_CACHE_PARSE_ERROR(5109L, "用户登录缓存异常"),
    USER_API_CODE_NOT_NULL(5110L, "ApiCode为空鉴权失败"),
    USER_PWD_UNPACK_INVALID(5111L, "非法伪造密码不可取～"),
    USER_FORBIDDEN_LOGIN(5201L, "用户被禁止登录"),
    USER_DATA_INVALID(5300L, "用户数据不完整"),
    API_HAS_BIND(5400L, "Api已被绑定"),
    POWER_CODE_MISS_FROM_HEADER(5401L, "header缺失权限码powerCode"),
    JWT_TOKEN_MISS_FROM_HEADER(5402L, "header缺失Jwt Token"),
    API_HAS_SUB_CHILDREN(5403L, "Api节点包含子节点，不能删除"),
    UNIQUE_VALID_ERROR(9001L, "数据重复或违反约束规则");


    private final long code;
    private final String message;

    private ErrorCode(long code, String message) {
        this.code = code;
        this.message = message;
    }

    public long getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }
}
